import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
import Layout from "@/layout";

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: "/login",
    component: () => import("@/views/login"),
    // import('@/views/login/index'),
    hidden: true,
  },

  {
    path: "/404",
    component: () => import("@/views/404"),
    hidden: true,
  },

  {
    path: "/401",
    component: () => import("@/views/401"),
    hidden: true,
  },

  {
    path: "/",
    component: Layout,
    redirect: "/welcome",
    children: [
      {
        path: "/welcome",
        name: "Welcome",
        component: () => import("@/views/dashboard/index"),
        meta: { title: "欢迎页", icon: "dashboard", affix: "true" },
      },
      {
        path: "/vpm/user/details",
        name: "userViews",
        component: () => import("@/views/vpm/user/view"),
        hidden: true,
      },
      {
        path: "/vpm/enterpriseinfo",
        name: "enterpriseinfo",
        component: () => import("@/views/vpmmanage/enterpriseinfo/index"),
        hidden: true,
      },
      {
        path: "/vpm/enterpriseinfo/detail",
        name: "enterpriseinfoDetail",
        component: () => import("@/views/vpmmanage/enterpriseinfo/detail"),
        hidden: true,
      },
      {
        path: "/vpm/enterpriseinfo/view",
        name: "enterpriseinfoView",
        component: () => import("@/views/vpmmanage/enterpriseinfo/view"),
        hidden: true,
      },
      {
        path: "vpm/menu/index",
        name: "Menu",
        component: () => import("@/views/sysmanage/menu/index"),
        meta: { title: "菜单管理", icon: "link" },
      },
      {
        path: "system/agent/list",
        name: "Menu",
        component: () => import("@/views/sysmanage/agent/index"),
        meta: { title: "坐席管理", icon: "link" },
      },
      {
        path: "system/agent/detail",
        name: "Menu",
        component: () => import("@/views/sysmanage/agent/detail"),
        meta: { title: "坐席编辑查看", icon: "link" },
      },

      {
        path: "system/video/list",
        name: "Menu",
        component: () => import("@/views/sysmanage/videomanage/index"),
        meta: { title: "视频明细报表", icon: "link" },
      },
      //坐席表现报表
      {
        path: "system/seat/seatperform",
        name: "Menu",
        component: () => import("@/views/sysmanage/videomanage/seatperform"),
        meta: { title: "坐席表现报表", icon: "link" },
      },
      {//视频截图
        path: "/system/meeting/file/picturelist",
        name: "Menu",
        component: () => import("@/views/sysmanage/videomanage/videocapture"),
        meta: { title: "视频截图", icon: "link" },
      },
      {//查看视频截图详情
        path: "system/video/videocapture/detail",
        name: "Menu",
        component: () => import("@/views/sysmanage/videomanage/videocaptureDetail"),
        meta: { title: "截图详情", icon: "link" },
      },
      {//申请编号和视频业务数据查询
        path: "/system/video/videoservicelist",
        name: "Menu",
        component: () => import("@/views/sysmanage/videomanage/videoService"),
        meta: { title: "申请编号和视频业务数据", icon: "link" },
      },


      {
        path: "system/video/detail",
        name: "Menu",
        component: () => import("@/views/sysmanage/videomanage/videodetail"),
        meta: { title: "视频管理", icon: "link" },
      },
      {
        path: "system/video/detail/play",
        name: "Menu",
        component: () => import("@/views/sysmanage/videomanage/videoPlay"),
        meta: { title: "视频播放", icon: "link" },
      },

      {
        path: "system/photo/detail",
        name: "Menu",
        component: () => import("@/views/sysmanage/videomanage/photodetail"),
        meta: { title: "图片管理", icon: "link" },
      },
      {
        path: "system/skill/list",
        name: "Menu",
        component: () => import("@/views/sysmanage/skill/index"),
        meta: { title: "技能组管理", icon: "link" },
      },
      {
        path: "system/skill/detail",
        name: "Menu",
        component: () => import("@/views/sysmanage/skill/detail"),
        meta: { title: "技能组编辑查看", icon: "link" },
      },
      {
        path: "system/agent/monitor",
        name: "Menu",
        component: () => import("@/views/sysmanage/agentmonitor/index"),
        meta: { title: "坐席监控", icon: "link" },
      },
      {
        path: "system/customer/monitor",
        name: "Menu",
        component: () => import("@/views/sysmanage/customermonitor/index"),
        meta: { title: "排队监控", icon: "link" },
      },
      {
        path: "vpmmanage/auth/detail",
        name: "authControl",
        component: () => import("@/views/vpmmanage/auth/detail"),
        meta: { title: "企业权限管理", icon: "link" },
      },
      {
        path: "vpmmanage/auth/index",
        name: "authIndex",
        component: () => import("@/views/vpmmanage/auth/index"),
        meta: { title: "企业权限管理", icon: "link" },
      },
      {
        path: "vpmmanage/auth/add",
        name: "authControlAdd",
        component: () => import("@/views/vpmmanage/auth/add"),
        meta: { title: "企业权限管理", icon: "link" },
      },
      {//企业配置项管理
        path: "vpmmanage/enterpriseconfig/index",
        name: "enterpriseconfigIndex",
        component: () => import("@/views/vpmmanage/enterpriseconfig/index"),
        meta: { title: "企业配置项管理", icon: "link" },
      },
      {//企业配置项管理详情
        path: "vpmmanage/enterpriseconfig/detail",
        name: "enterpriseconfigDetail",
        component: () => import("@/views/vpmmanage/enterpriseconfig/detail"),
        meta: { title: "配置项管理", icon: "link" },
      },
      {//坐席角色管理
        path: "vpm/auth/detail",
        name: "vpmManage",
        component: () => import("@/views/vpm/auth/detail"),
        meta: { title: "坐席角色管理", icon: "link" },
      },
      {//坐席角色管理——新增
        path: "vpm/auth/add",
        name: "Menu",
        component: () => import("@/views/vpm/auth/add"),
        meta: { title: "权限管理", icon: "link" },
      },

      {
        path: "vpm/user/view",
        name: "userView",
        component: () => import("@/views/vpmmanage/user/view"),
        meta: { title: "用户管理", icon: "link", activeUrl: "/vpm/user/view" },
      },
      {
        path: "vpm/user/index",
        name: "userIndex",
        component: () => import("@/views/vpmmanage/user/index"),
      },
      {
        path: "vpm/user/detail",
        name: "UserDetail",
        component: () => import("@/views/vpmmanage/user/detail"),
        meta: { title: "用户管理", icon: "link", activeUrl: "/vpm/user/view" },
      },
      {
        path: "system/organ/index",
        name: "organ",
        component: () => import("@/views/sysmanage/organ/index"),
        meta: { title: "机构管理", icon: "link" },
      },
      {
        path: "vpm/videonumber/index",
        name: "videonumber",
        component: () => import("@/views/vpmmanage/videonumber/index"),
        meta: { title: "视讯号码池管理", icon: "link", activeUrl: "/vpm/videonumber/index" },
      },
      {
        path: "vpm/videonumber/detail",
        name: "videonumberDetail",
        component: () => import("@/views/vpmmanage/videonumber/detail"),
        meta: { title: "视讯号码池管理", icon: "link", activeUrl: "/vpm/videonumber/index" },
      },
      {
        path: "vpm/numberbind/index",
        name: "NumberBind",
        component: () => import("@/views/vpmmanage/numberbind/index"),
        meta: { title: "视讯号码绑定记录", icon: "link" },
      },
      {
        path: "vpm/videomanage/index",
        name: "videomanage",
        component: () => import("@/views/vpmmanage/videomanage/index"),
        meta: { title: "视频管理", icon: "link", activeUrl: "/vpm/videomanage/index" },
      },
      {
        path: "vpm/restmanage/index",
        name: "restmanage",
        component: () => import("@/views/vpmmanage/restmanage/index"),
        meta: { title: "小休管理", icon: "link", activeUrl: "/vpm/restmanage/index" },
      },
      {
        path: "vpm/restmanage/detail",
        name: "restmanageDetail",
        component: () => import("@/views/vpmmanage/restmanage/detail"),
        meta: { title: "小休管理", icon: "link", activeUrl: "/vpm/restmanage/index" },
      },
      {//客户管理
        path: "vpm/customer/index",
        name: "customer",
        component: () => import("@/views/vpmmanage/customer/index"),
        meta: { title: "客户管理", icon: "link", activeUrl: "/vpm/customer/index" },
      },
      {//客户管理_新增
        path: "vpm/customer/detail",
        name: "customerDetail",
        component: () => import("@/views/vpmmanage/customer/detail"),
        meta: { title: "客户管理", icon: "link", activeUrl: "/vpm/customer/detail" },
      },
      {//报表管理_呼叫统计_工作情况统计_满意度统计
        path: "vpm/reportsinformation/index",
        name: "reportsinformation",
        component: () => import("@/views/vpmmanage/reportsinformation/index"),
        meta: { title: "客户管理", icon: "link", activeUrl: "vpm/reportsinformation/index" },
      },
      
      {//问卷管理
        path: "vpm/questionmanage/index",
        name: "questionmanage",
        component: () => import("@/views/vpmmanage/questionmanage/index"),
        meta: { title: "问卷管理", icon: "link", activeUrl: "vpm/questionmanage/index" },
      },
      {//问卷管理_新增
        path: "vpm/questionmanage/detail",
        name: "questionmanageDetail",
        component: () => import("@/views/vpmmanage/questionmanage/detail"),
        meta: { title: "问卷管理", icon: "link", activeUrl: "vpm/questionmanage/detail" },
      },
      {//风险揭示管理
        path: "vpm/riskrevealmanage/index",
        name: "riskrevealmanage",
        component: () => import("@/views/vpmmanage/riskrevealmanage/index"),
        meta: { title: "风险揭示管理", icon: "link", activeUrl: "vpm/riskrevealmanage/index" },
      },
      {//风险揭示管理_新增
        path: "vpm/riskrevealmanage/detail",
        name: "riskrevealmanageDetail",
        component: () => import("@/views/vpmmanage/riskrevealmanage/detail"),
        meta: { title: "风险揭示管理", icon: "link", activeUrl: "vpm/riskrevealmanage/detail" },
      },
      {//朗读声明管理
        path: "vpm/readstatemanage/index",
        name: "readstatemanage",
        component: () => import("@/views/vpmmanage/readstatemanage/index"),
        meta: { title: "朗读声明管理", icon: "link", activeUrl: "vpm/readstatemanage/index" },
      },
      {//朗读声明管理_新增
        path: "vpm/readstatemanage/detail",
        name: "readstatemanageDetail",
        component: () => import("@/views/vpmmanage/readstatemanage/detail"),
        meta: { title: "朗读声明管理", icon: "link", activeUrl: "vpm/readstatemanage/detail" },
      },
      {//合同管理
        path: "vpm/contractmanage/index",
        name: "contractmanage",
        component: () => import("@/views/vpmmanage/contractmanage/index"),
        meta: { title: "合同管理", icon: "link", activeUrl: "vpm/contractmanage/index" },
      },
      {//合同管理_新增
        path: "vpm/contractmanage/detail",
        name: "contractmanageDetail",
        component: () => import("@/views/vpmmanage/contractmanage/detail"),
        meta: { title: "合同管理", icon: "link", activeUrl: "vpm/contractmanage/detail" },
      },
      {//流程装配(业务流程管理)
        path: "vpm/processmanage/index",
        name: "processmanage",
        component: () => import("@/views/vpmmanage/processmanage/index"),
        meta: { title: "业务流程管理", icon: "link", activeUrl: "vpm/processmanage/index" },
      },
      {//流程装配_新建(业务流程管理)
        path: "vpm/processmanage/detail",
        name: "processmanageDetail",
        component: () => import("@/views/vpmmanage/processmanage/detail"),
        meta: { title: "业务流程管理", icon: "link", activeUrl: "vpm/processmanage/detail" },
      },
      {//其他管理
        path: "vpm/othermanage/index",
        name: "othermanage",
        component: () => import("@/views/vpmmanage/othermanage/index"),
        meta: { title: "其他管理", icon: "link", activeUrl: "vpm/othermanage/index" },
      },
      {//小结管理_添加小结
        path: "vpm/addsummary/detail",
        name: "addsummaryDetail",
        component: () => import("@/views/vpmmanage/othermanage/addsummary"),
        meta: { title: "添加小结", icon: "link", activeUrl: "vpm/addsummary/detail" },
      },
      {//业务设置——业务产品
        path: "vpm/businessproducts/index",
        name: "businessproducts",
        component: () => import("@/views/vpmmanage/businessproducts/index"),
        meta: { title: "业务产品", icon: "link", activeUrl: "vpm/businessproducts/index" },
      },
      {//业务设置-资料库目录
        path: "vpm/datadirectory/index",
        name: "datadirectory",
        component: () => import("@/views/vpmmanage/datadirectory/index"),
        meta: { title: "资料库", icon: "link", activeUrl: "vpm/datadirectory/index" },
      },
      {//业务设置-资料库ppt 视频 链接
        path: "vpm/database/index",
        name: "database",
        component: () => import("@/views/vpmmanage/database/index"),
        meta: { title: "资料库", icon: "link", activeUrl: "vpm/database/index" },
      },
      {//业务设置-资料库ppt配置
        path: "vpm/database/pptdetail",
        name: "pptdetail",
        component: () => import("@/views/vpmmanage/database/pptdetail"),
        meta: { title: "资料库配置", icon: "link", activeUrl: "vpm/database/pptdetail" },
      },
      {//业务设置-资料库视频配置
        path: "vpm/database/videodetail",
        name: "videodetail",
        component: () => import("@/views/vpmmanage/database/videodetail"),
        meta: { title: "资料库配置", icon: "link", activeUrl: "vpm/database/videodetail" },
      },



      // {
      //   path: 'system/role/index',
      //   name: 'Role',
      //   component: () =>
      //     import('@/views/sysmanage/role/index'),
      //   meta: { title: '角色管理', icon: 'link' }
      // },
    ],
  },

  // 404 page must be placed at the end !!!
  { path: "*", redirect: "/404", hidden: true },
];

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes,
  });

const router = createRouter();

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
}

export default router;
